#ifndef QTGL_H
#define QTGL_H

#include <QMainWindow>
#include <QWindow>
#include <QOpenGLContext>
#include <qopenglfunctions>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include "Scene.h"

class QTGL : public QWindow
{
	Q_OBJECT

public:
	QTGL(QScreen *parent = 0);
	~QTGL();

protected:
	void keyPressEvent(QKeyEvent *e);
	void mousePressEvent(QMouseEvent *e);
	void mouseReleaseEvent(QMouseEvent *e);
	void mouseMoveEvent(QMouseEvent *e);
    void wheelEvent(QWheelEvent *e);


protected slots:
    void resizeGl();
    void paintGl();
    void updateScene();
private:
	QOpenGLContext * _ctx;
    QOpenGLFunctions *_func;
	Scene *_scene;

	void initializeGl();

	bool _rotate_status;
	int _mouse_x;
	int _mouse_y;
};

#endif // QTGL_H
